<?php

global $xoopsConfig,$xoopsOption,$xoopsUser,$xoopsTpl;


/**
 * MUST include our module page header
 */
require("header.inc");
require_once XOOPS_ROOT_PATH."/header.php";	

$right_now = mktime();

$conferences =& $xoopsDB->query("SELECT conf_id,title,start_date,end_date,reg_start,reg_end" .
								" FROM " . $xoopsDB->prefix("confreg_conferences") .
								' WHERE ((reg_start <= FROM_UNIXTIME(' . $right_now . ')) AND' .
								       '(reg_end >= FROM_UNIXTIME(' . $right_now . ')))' );
$conf_count = $xoopsDB->getRowsNum($conferences);

echo "<table width=90%>";
echo '<tr><th colspan=6 style="text-align:center;">' . _MD_CONFREG_PICK_CONF . '</th></tr>';
// echo '<tr><th width=33% style="text-align:center;">Title</th><th style="text-align:center;">Start Date</th><th style="text-align:center;">End Date</th><th style="text-align:center;">Reg Open</th><th style="text-align:center;">Registration<br />Closes</th><th>&nbsp;</th></tr>';
echo '<tr><th width=33% style="text-align:center;">Title</th><th style="text-align:center;">Conference Starts</th><th style="text-align:center;">Conference Ends</th><th style="text-align:center;">Registration Closes</th><th>&nbsp;</th></tr>';
if ($conf_count > 0) {
	while ($confData = $xoopsDB->fetchArray($conferences)) {
		echo '<tr style="vertical-align:text-top;">';
		echo "<td>" . $confData['title'] . "</td>";
		echo '<td style="text-align:center;">' . substr($confData['start_date'],0,10) . "</td>";
		echo '<td style="text-align:center;">' . substr($confData['end_date'],0,10) . "</td>";
//		echo '<td style="text-align:right;">' . substr($confData['reg_start'],0,10) . "</td>";
		echo '<td style="text-align:center;">' . substr($confData['reg_end'],0,10) . "</td>";
		echo '<td style="text-align:center;">' . 
			  '<form action="register.php" method=post>' . 
			  '<input type=hidden name=conf_id value=' . $confData['conf_id'] . '>' .
			  '<input type=submit name=submit value="' . _MD_CONFREG_REGISTER . '"></form></td>';
		echo "</tr>";
	}
} else {
	echo '<tr><td colspan=5>' . _MD_CONFREG_NONEAVAIL . '</td></tr>';
}
echo "</table></div><br /><br />";

// Xoops page footer
include XOOPS_ROOT_PATH."/footer.php";


/*
 * This file was generated by XBS ModGen, (c) 2006 A Kitson, UK. See http://xoobs.net
 * ModGen is a Module Code Generator for the Xoops CMS.  See http://xoops.org
 */
?>
